<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>我的集训</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
	<c:set var="ctx" value="${pageContext.request.contextPath}" />
    <link rel="stylesheet" href="${ctx}/assets/css/amazeui.min.css">
    <link rel="stylesheet" href="${ctx}/assets/css/style.css?v=2.3">
    <link rel="stylesheet" href="${ctx}/assets/css/index.css?v=2.3">
    <script src="${ctx}/assets/js/myAlert.js"></script>
    <script>
    	var counsTels='${counseTel}';
    	if(counsTels==""){
    		myAlert("咨询师登录超时");
    		location.href="login.jsp";
    	}
    </script>
</head>
<body class="bg-gray">
<header data-am-widget="header" class="am-header am-header-default am-header-fixed am-border-bottom">
    <div class="am-header-left am-header-nav">
        <a onclick="history.go(-1)"> <i class="icon_8"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        我的集训
    </h1>
    <div  class="am-header-right am-header-nav am-text-right font-14" >
        <a href="addJixun.jsp"> 新增</a>
    </div>
</header>
<section class="am-padding-bottom-sm" id="amz-main" data-tag="css-nav">

    <!--切换tab-->
    <div data-am-widget="tabs"
         class="am-tabs am-tabs-d2 font-14 bg-white am-margin-top-sm pinglun-tabs am-border-bottom">
        <ul class="am-tabs-nav am-cf">
            <li class="bg-white" onclick="window.location.href='mypeixun.jsp'">
                <div class="width-100 border-right margin-top-6 height-30"><a>培训</a></div>
            </li>
            <li class="bg-white am-active" onclick="window.location.href='25.jsp'">
                <div class="width-100 border-right margin-top-6 height-30"><a >集训</a></div>
            </li>
        </ul>

    </div>

    <!--列表-->
    <div class="margin-top-42 order_list">
        
    </div>


</section>

<footer data-am-widget="navbar" class="am-navbar am-cf am-navbar-default " id="">
    <ul class="am-navbar-nav am-cf am-avg-sm-4">
		<li>
            <a href="myzixun.jsp" class="">
                <img src="${ctx}/assets/images/icon/index/icon_zixun_on.png"
                     alt="我的咨询"/>
                <span class="am-navbar-label">我的咨询</span>
            </a>
        </li>

        <li>
            <a href="mypeixun.jsp" class="selected">
                <img src="${ctx}/assets/images/icon/index/icon_peixun.png"
                     alt="我的集训"/>
                <span class="am-navbar-label">我的集训</span>
            </a>
        </li>
        <li>
            <a href="myCounse.jsp" class="">
                <img src="${ctx}/assets/images/icon/index/icon_user.png"
                     alt="我的"/>
                <span class="am-navbar-label">我的</span>
            </a>
        </li>
    </ul>
</footer>



<div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">提醒</div>
        <div class="am-modal-bd">
           您确认删除此集训吗？
        </div>
        <div class="am-modal-footer">
            <span class="am-modal-btn" data-am-modal-cancel>取消</span>
            <span class="am-modal-btn" data-am-modal-confirm>确认</span>
        </div>
    </div>
</div>


<script src="${ctx}/assets/js/jquery.min.js"></script>
<script src="${ctx}/assets/js/amazeui.min.js"></script>


<script>
    $(function() {
    	var counselorList=$.ajax({url:"${ctx}/getMyStudyList?studyType=1",async:false});
        var jsonCounselor=JSON.parse(counselorList.responseText);
    	if(jsonCounselor.resultCode=="0"){
    	var html="";
	        for(var i=0;i<jsonCounselor.studylist.length;i++){
	    	html+="<div class='traincamp_item bg-white am-padding-top-sm am-padding-left-sm am-padding-right-sm border-bottom am-margin-bottom-sm'>";
	         html+="       <div class='box' onclick=goPeiDesc("+jsonCounselor.studylist[i].id+")>";
	        html+="            <div><img class='img-70-70' src='"+jsonCounselor.studylist[i].studyUrl+"'></div>";
	        html+="        <div class='box-1 am-padding-left-sm'>";
	        html+="                <div class='font-color-13 font-bold font-16 word-space-2' onclick='goPeiDesc("+jsonCounselor.studylist[i].id+")'>"+jsonCounselor.studylist[i].studyTitle+"</div>";
	        html+="            <div class=''>";
	        html+="                    <ul class='am-pagination am-pagination-default' >";
			    if(null!=jsonCounselor.studylist[i].studyLabel && ""!=jsonCounselor.studylist[i].studyLabel){
			    	var studyLabel=jsonCounselor.studylist[i].studyLabel;
			    	var label=studyLabel.split(",");
			    	for(var j=0;j<label.length;j++){
			    		html+="  <li class='am-active'>";
			   			html+="      <a href='#' class=''>"+label[j]+"</a>";
			    		html+="  </li>";
			    	}
			    }
			    html+="                    </ul>";
	        html+="            </div>";
	         html+="                <div class='font-color-16'>集训方向："+jsonCounselor.studylist[i].studyDirection+"</div>";
	        html+="        </div>";
	        html+="    </div>";
	        html+="    <div class='am-g    am-padding-bottom-sm  prelative'>";
	        html+="        <div class='am-u-sm-12  font-15 '>";
	        html+="            <div class=' font-color-13  am-padding-top-xs  box'>";
	        html+="                <div class='width-17px'><i class='icon_28_2'></i></div>";
			html+="<div class='box-1'><span>人数上限：</span><span>"+jsonCounselor.studylist[i].maxStudent+"</span><span class='font-color-16'>(已报"+jsonCounselor.studylist[i].signStudent+")</span>";
	        html+="                </div>";
	        html+="            </div>";
	        html+="        </div>";
	        html+="        <div class='am-u-sm-12  font-15'>";
	        html+="            <div class=' font-color-13  am-padding-top-xs  box'>";
	        html+="                <div class='width-17px'><i class='icon_29_2'></i></div>";
	        html+="<div class='box-1'><span>集训时间："+jsonCounselor.studylist[i].startStudyStr+" -- "+jsonCounselor.studylist[i].endStudyStr+"</span></div>";
	        html+="            </div>";
	        html+="        </div>";
	        html+="       <div class='am-u-sm-12  font-15'>";
	        html+="            <div class=' font-color-13  am-padding-top-xs  box'>";
	        html+="                <div class='width-17px'><i class='icon_20_2'></i></div>";
	        html+="                <div class='box-1 font-color-17'><span>集训价格：&yen;"+jsonCounselor.studylist[i].studyPrice+"</span></div>";
	        html+="            </div>";
	        html+="        </div>";
	        html+="    </div>";
	        html+="    <div class='font-14  '>";
	        html+="        <div class='am-g am-text-center font-color-16 am-padding-top-xs am-padding-bottom-xs border-tops'>";
	        html+="            <div class='am-u-sm-4 border-right shanchu' data-id='"+jsonCounselor.studylist[i].id+"'><span class='prelative padding-left-15'><i class='icon_021_1'></i>删除</span></div>";
	        html+="            <div class='am-u-sm-4 border-right' onclick='window.location.href=\"${ctx}/updateJixun?studyId="+jsonCounselor.studylist[i].id+"\"'><span class='prelative padding-left-15'><i class='icon_022_1'></i>修改</span></div>";
	        html+="            <div class='am-u-sm-4 ' onclick='window.location.href=\"19.jsp?signBaomin="+jsonCounselor.studylist[i].signStudent+"&studyId="+jsonCounselor.studylist[i].id+"\"'><span class='prelative padding-left-15'><i class='icon_023_1'></i>报名情况</span></div>";
	        html+="        </div>";
	        html+="    </div>";
	        html+="</div>";
    	}
    	$(".order_list").html(html);
    	}
    
        $('.traincamp_item').find('.shanchu').on('click', function() {

            $('#my-prompt').modal({
                relatedTarget: this,
                onConfirm: function(options) {
                    var $link = $(this.relatedTarget);
                    var msg = $link.length ? '你要删除的 ID 为 ' + $link.data('id') :
                            '什么玩意';
                    var studyId=$link.data('id') ;
                    
                    var respStr=$.ajax({url:"${ctx}/deleteStudy?studyId="+studyId,async:false});
			        var isDelete=JSON.parse(respStr.responseText);
			        
			        if(isDelete.resultCode=="0"){
			        	location.reload(true);   
			        }else{
			        	myAlert(isDelete.resultDesc);
			        }
                    
                },
                onCancel: function() {

                }
            });
        });


    });
</script>

</body>
</html>